<template>
  <div class="home-banner" @click="onClick">
    <div class="bg-img" :style="{backgroundImage: bgImage}">
      <div class="sub-title">{{subTitle}}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    subTitle: String,
    img: String
  },
  computed: {
    bgImage () {
      return 'url(' + this.img + ')'
    }
  },
  methods: {
    onClick () {
      this.$emit('onClick')
    }
  }
}
</script>

<style lang="scss" scoped>
  .home-banner{ 
    margin-top: 20px;
    padding: 0 20px;
    .bg-img{
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 125px;
      border-radius: 10px;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      .sub-title{
        padding: 5px 15px;
        background-color: rgba($color: #fff, $alpha: 0.8);
        border: 2px solid #ccc;
        border-radius: 50px;
        margin-top: 62px;
        font-size: 17px;
        font-weight: 550;
        color: #221816;
      }
    }
  }
</style>
